count how many characters in the same position are eqial in both strings

87

sum(1 if c1 == c2 else 0 for c1, c2 in zip(string1, string2))
sum(c1 == c2 for c1, c2 in zip(string1, string2))

Comments

Submit
0 Comments